package cn.kgc.tangcco.redirect;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 李昊哲
 * @Description
 * @create 2020/10/19 上午11:05
 */
@WebServlet(urlPatterns = "/redirect02")
public class Redirect02 extends HttpServlet {

    private static final long serialVersionUID = -1703370610975078883L;

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("redirect02");
        String slogan = request.getParameter("slogan");
        System.out.println("redirect02接slogan>>>" +  slogan);
        String header = request.getHeader("slogan");
        System.out.println("redirect02的header中slogan>>>" +  header);
        response.setHeader("slogan",header);
        response.sendRedirect(request.getContextPath() + "/redirect03?slogan=" + slogan);
    }
}
